package com.j283_5.wisdom_park.vo.warning_management;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.j283_5.wisdom_park.pojo.Warning;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.sql.Timestamp;


/**
 * @author shkstart
 * @create 2022-05-03-21:09
 */
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class WarningVo implements Serializable {
    /**
     * 预警记录id
     */
    @TableId(value = "wrec_id", type = IdType.AUTO)
    private Integer wrecId;
    /**
     * 设备名称
     */
    private String ddetName;

    /**
     * 设备编号
     */
    private String ddetNumber;
    /**
     * 安装位置
     */
    private String dinfLocation;
    /**
     * 预警内容
     */
    private String wrecContent;

    /**
     * 0:告警事件,1:设备故障
     */
    private String wrecTypestate;

    /**
     * 0:未派单,1:已派单,2:已处理
     */
    private String wrecState;

    /**
     * 预警时间
     */
    private Timestamp wrecDate;
    /**
     * 设备类型名称
     */
    private String ddetStyle;

    public WarningVo(Warning warning){
        this.ddetName = warning.getDdetName();
        this.ddetNumber = warning.getDdetNumber();
        this.ddetStyle = warning.getDdetStyle();
        this.dinfLocation = warning.getDinfLocation();
        this.wrecId = warning.getWrecId();
        this.wrecContent = warning.getWrecContent();
        this.wrecDate = warning.getWrecDate();
        if (warning.getWrecTypestate() != null){
            setWrecTypestate(warning.getWrecTypestate());
        }
        if (warning.getWrecState() != null){
            setWrecState(warning.getWrecState());
        }
    }
    public String getDdetStyle() {
        return ddetStyle;
    }

    public void setDdetStyle(String ddetStyle) {
        this.ddetStyle = ddetStyle;
    }

    public Integer getWrecId() {
        return wrecId;
    }

    public void setWrecId(Integer wrecId) {
        this.wrecId = wrecId;
    }

    public String getDdetName() {
        return ddetName;
    }

    public void setDdetName(String ddetName) {
        this.ddetName = ddetName;
    }

    public String getDdetNumber() {
        return ddetNumber;
    }

    public void setDdetNumber(String ddetNumber) {
        this.ddetNumber = ddetNumber;
    }

    public String getDinfLocation() {
        return dinfLocation;
    }

    public void setDinfLocation(String dinfLocation) {
        this.dinfLocation = dinfLocation;
    }

    public String getWrecContent() {
        return wrecContent;
    }

    public void setWrecContent(String wrecContent) {
        this.wrecContent = wrecContent;
    }

    public String getWrecTypestate() {
        return wrecTypestate;
    }

    public void setWrecTypestate(String wrecTypestate) {
        this.wrecTypestate = wrecTypestate;
    }

    public String getWrecState() {
        return wrecState;
    }

    public void setWrecState(String wrecState) {
        this.wrecState = wrecState;
    }

    public Timestamp getWrecDate() {
        return wrecDate;
    }

    public void setWrecDate(Timestamp wrecDate) {
        this.wrecDate = wrecDate;
    }

    public void setWrecTypestate(Integer wrecTypestate){
        switch (wrecTypestate){
            case 0:
                this.wrecTypestate = "告警事件";
                return;
            case 1:
                this.wrecTypestate = "设备故障";
                return;
            default:
                this.wrecTypestate = "告警事件";
        }
    }

    public void setWrecState(Integer wrecState){
        switch (wrecState){
            case 0:
                this.wrecState = "未派单";
                return;
            case 1:
                this.wrecState = "已派单";
                return;
            case 2:
                this.wrecState = "已处理";
                return;
            default:
                this.wrecState = "未派单";
        }
    }
}
